<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        
    </style>
</head>
<body>
    <input type="button" value="获取置顶文章" class="getArticle">
</body>
<script src="./ajax.js"></script>
<script>

    const getArticle = document.querySelector(".getArticle")

    getArticle.onclick = function(){
        ajax({
            url:"https://www.wanandroid.com/article/top/json",
            success:(res)=>{
                console.log(res);
            },
            error:(code)=>{
                console.log("失败", code);
            },
            timeout: 10000
        })
    }

</script>
</html>